package com.jk.util;

import java.io.FileWriter;
import java.io.IOException;

/**
 * 类描述：
 *
 * @ClassName AlipayConfig
 * @Description TODO
 * @Author fandasen
 * @Date 2022/6/7 17:23
 * @Version 1.0
 */

public class AlipayConfig {
    // 应用ID,APPID，收款账号既是的APPID对应支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID
    public static String APP_ID = "2021000119699151"; //测试
    // 商户私钥，PKCS8格式RSA2私钥
    public static String APP_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdhJ9nH1frhyjOijLdhhDOHbFcEaibaKBdwmHklsIAIlAGduCFZUfnkv4kSX4+ToMfQtPbHs79XJI9dY7/jfIjCaD+dejy5PuRTKUMpcFqIh1wx+dccbSou9RKCZIUVN/wodTVRtUxQx/S2gV3Xbve5O7TqR8hhaC3wML8J9UyyQe5tTnKy0yYZki5MXM7m7iJHY/RaRRkY5d/uOP63COt2yXCAzC0PtuL4/58ZnYB+M5VXpemuqlKuOWCa+z3dhmZFES7hX73UIla5CnXIkrnaNbkytlCPwVw/Dxxu4TD3EMAnIR7Dp9uiTMlwIwBMxzMa8+WZdeeRtAhQQojgyDPAgMBAAECggEAb+ZQSzTkA4jf/2ID4oUkGRjU72AIFGcOTa0SWA6VQP0fNohq1bjujN9KtcKT8XVbBvE1iZtoVmrV5N1Hudo/4o4rlblzxGHRKRZ2xfZW4avcmEsa2/xW5+uPUw1bfiARemOsy9pnB3j0+Zgye+rV1PFzjF+/otPIKeHBYtp1RX6UVrOtS96lrY4BbWvtHQ/75yFIH9l0oHJCRS+LSdim/aHXv+QKuXlsHF1oFezmkDjl2LAZa3AyZ/vsk+Lhbr8v7NaEHMBWx6t8WaQAlQIZFluqJAdPgx8kU09LRaHTu4xSgN9OKZwnKEWGNeQAtQ8I4K8AFQIxZe1eursIwogASQKBgQDnV1ArZGKmJst6TBKt5pl3IzcWfx5OhOfvKmMkA2eVenkTyG5T9rIs5lyr6JJ+fCFOD2NCS5ypj3HQiUo235d+M+woRFgzZrKJlrnBYKUH6aVAjlcSyhI5ksZW+T3vJw2Lgil/bmba1hvrxaHEKnfp9yOsn6DBEiKLQoqDiu+l1QKBgQCuTt/fsQ2W+ZlFt4D5OQaVRKNVi+5cOQSY3mUdrugX/U4O/wKB1vJqLcKNKHkC4eAcjtEnHWyyP9Ch+cn7+6La6k3BUCwxSXD+HbFIaq98VuuWS595t5N/V0xPpOyr3nMs2arPBprobX1htMasNTMA0a+0ZbbfMo8l3NQIxIGKEwKBgQCkP2eaB0HK+YxKHiy87xZScdwwyrv3v4D0W0HcVdZ7WGMSWqGKV4KVQlDVdOBdkUAMLfypGwn1kPSbvH3Gi+UBI1guFqgQhn+IFE16MGW7QnWjaewEWRerbLwJEBia7T0+qYFRCk9YW9+i+8QohIZyxJa9fvAhZADGos25KzGOqQKBgQCCcRwwNjtJRDhjZ9PorbgzdE4W8sTJ1xGNpMBe2kltym3j4wppSAXZV61EHYmRkp84P9hdQTPaoM7sqBVzsPhKgxT1GZ44tBEO2gGVg+EXV6StsKIDYFHM9fNxlqZWZ/4hDjM5AmRik61EtRgIPzeP4Vtv0L5tgVSGrR8wAH5AaQKBgBHxor25VIqYrJZ4C2CPA1t5PFyJoTzWQOaNQkSbc6NiO54jENmWiSoxksMSVOgLTWxPHgDQ8fLtdQwop25709iZ37e8lAeeGWFPb5X23zkGWWvHLLNuygddD/MwNIQlsG+0og5Fq6JUyOLdHK3kNfc8OMI9lyuCcMMa5LyeiOr5";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr29FnxUmsjqqF3+nraC6OaknJf/wqNYlfENJjLe741QqcUUUlEqDC9NA1EQV5mUuoCdgPJBMSPax95jV+83omk6xV4tl6j3/t4Okj9jssiGurirDpJrQWsz2OdK1akSlMBxZEHbO7lXuXTrUWlGJAHgIgRFF9i/YmknyLc4YodCQ24O3S6DQuxPTYNG7I/eTOTsVXlMqueNvDOFA2p7NbsjRzlTzFVYBdWOw+tJ8M5fmrBTp0kC8iUiOUK/AwSsCZ2k5ntnGanjKrQGuj7RU3vXHHWoHQ0AWhSi6zvvNcfI0s0eg8IYhhi9JbKhsKVDGx56fsKgHSBaRau6m6yqpLQIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:9002/tz/toshopcart";
    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
    public static String return_url = "http://localhost:9002/tz/toshopcart";
    // 签名方式
    public static String sign_type = "RSA2";
    // 字符编码格式
    public static String CHARSET = "UTF-8";

    // 支付宝网关，这是沙箱的网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do"; //测试

    // 支付宝网关
    public static String log_path = "D:\\pay\\";

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
